const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('act_id_priv_mapping', {
    id: {
      type: DataTypes.STRING(64),
      allowNull: false,
      primaryKey: true,
      field: 'ID_'
    },
    privId: {
      type: DataTypes.STRING(64),
      allowNull: false,
      references: {
        model: 'act_id_priv',
        key: 'id_'
      },
      field: 'PRIV_ID_'
    },
    userId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'USER_ID_'
    },
    groupId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'GROUP_ID_'
    }
  }, {
    sequelize,
    tableName: 'act_id_priv_mapping',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "ID_" },
        ]
      },
      {
        name: "ACT_FK_PRIV_MAPPING",
        using: "BTREE",
        fields: [
          { name: "PRIV_ID_" },
        ]
      },
      {
        name: "ACT_IDX_PRIV_USER",
        using: "BTREE",
        fields: [
          { name: "USER_ID_" },
        ]
      },
      {
        name: "ACT_IDX_PRIV_GROUP",
        using: "BTREE",
        fields: [
          { name: "GROUP_ID_" },
        ]
      },
    ]
  });
};
